#!/bin/bash



##这是配置Python3的脚本
##创建时间2018-9-20
yum install -y wget gcc
echo 请选择安装方式
echo [1]采用yum安装
echo [2]采用源码安装
read p
if [ $p == 1 ];then
	echo 安装EPEL依赖
	yum install epel-release
	echo 安装IUS软件源
	yum install https://centos7.iuscommunity.org/ius-release.rpm
	echo 安装Python3.6
	rm -rf /bin/python3
	ln -s /bin/python3.6 /bin/python3
	echo 安装pip3
	yum install python36u-pip
	echo 创建一个到pip3的符号链接
	rm -rf /bin/pip3
	ln -s /bin/pip3.6 /bin/pip3
elif [ $p == 2 ];then
	yum -y groupinstall development
	yum -y install zlib-devel
	echo 请输入自定义Python源码URL，默认请回车
	read u
	if [ -z "$u" ];then
		wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
		tar xJf Python-3.6.0.tar.xz
		cd Python-3.6.0
		./configure
		make&&make install
	else
		echo 请输入URL  [tar.gz]
		wget -O python.tar.gz $u
		tar xJf python.tar.gz
		cd python
		 ./configure
		make&&make install
	fi
else
	echo 选择错误
fi
		
